<script>
$(function(){
$("#tongiao_id").multiselect({
	   selectedText: "Đã chọn # trong # tôn giáo",
	   checkAllText: 'Chọn tất cả',
		uncheckAllText: 'Bỏ tất cả',
	   noneSelectedText: ' -- Tất cả --'
	});
$("#dantoc_id").multiselect({
	   selectedText: "Đã chọn # trong # dân tộc",
	   checkAllText: 'Chọn tất cả',
		uncheckAllText: 'Bỏ tất cả',
	   noneSelectedText: ' -- Tất cả --'
	});
$("#khoahocid").multiselect({
	   selectedText: "Đã chọn # trong # khóa học",
	   checkAllText: 'Chọn tất cả',
		uncheckAllText: 'Bỏ tất cả',
	   noneSelectedText: ' -- Tất cả --'
	});
$("#tinhtp_id").multiselect({
	   selectedText: "Đã chọn # trong # tỉnh/thành phố",
	   checkAllText: 'Chọn tất cả',
		uncheckAllText: 'Bỏ tất cả',
	   noneSelectedText: ' -- Tất cả --'
	});
$("#chidoansv_id").multiselect({
	   selectedText: "Đã chọn # trong # chi đoàn",
	   checkAllText: 'Chọn tất cả',
		uncheckAllText: 'Bỏ tất cả',
	   noneSelectedText: ' -- Tất cả --'
	});
	});
</script>
<?php echo $form->create('Chidoansv');?>
<table>
<tr>
<td><?php echo $form->input('tongiao_id',array('id'=>'tongiao_id','label'=>'Tôn giáo','multiple'=>'multiple','options'=>$tongiaos,'style'=>'width: 120px;'));?></td>
<td><?php echo $form->input('dantoc_id',array('id'=>'dantoc_id','label'=>'Dân tộc','multiple'=>'multiple','options'=>$dantocs,'style'=>'width: 120px;'));?></td>
<td><?php echo $form->input('tinhtp_id',array('id'=>'tinhtp_id','label'=>'Tỉnh/Thành phố','multiple'=>'multiple','options'=>$tinhtps,'style'=>'width: 120px;'));?></td>
</tr>
<tr>
<td><?php echo $form->input('khoahocid',array('id'=>'khoahocid','label'=>'Khóa học','multiple'=>'multiple','options'=>$khoahocs,'style'=>'width: 250px;'));?></td>
<td><?php echo $form->input('loaidv',array('id'=>'loaidv','label'=>'Loại chi đoàn','type'=>'select','options'=>array('cb'=>'Chi đoàn cán bộ','sv'=>'Chi đoàn sinh viên'),'empty'=>'--Tất cả--'));?></td>
<td>
<div id='chidoan'>
<?php echo $form->input('chidoansv_id',array('id'=>'chidoansv_id','label'=>'Chi đoàn','multiple'=>'multiple','options'=>$chidoans,'style'=>'width: 280px;'));?>
</div>
</td>
</tr>

</table>
<?php echo $form->end('Thống kê');?>
<?php if(!empty($thongke)){?>
<?php
$tongnamcb = $thongke['canbo']['thanhnien']['nam']+$thongke['canbo']['doanvien']['nam']+$thongke['canbo']['dangvien']['nam']; 
$tongnamsv = $thongke['sinhvien']['thanhnien']['nam']+$thongke['sinhvien']['doanvien']['nam']+$thongke['sinhvien']['dangvien']['nam'];
$tongnucb = $thongke['canbo']['thanhnien']['nu']+$thongke['canbo']['doanvien']['nu']+$thongke['canbo']['dangvien']['nu'];
$tongnusv = $thongke['sinhvien']['thanhnien']['nu']+$thongke['sinhvien']['doanvien']['nu']+$thongke['sinhvien']['dangvien']['nu'];
?>
<table id='tables'>
<tr>
<th rowspan=2></th>
<th colspan=2>Cán bộ</th>
<th colspan=2>Sinh viên</th>
</tr>
<tr>
<th>Nam</th>
<th>Nữ</th>
<th>Nam</th>
<th>Nữ</th>
</tr>
<tr>
<td>Thanh niên</td>
<td><?php echo $thongke['canbo']['thanhnien']['nam']?></td>
<td><?php echo $thongke['canbo']['thanhnien']['nu']?></td>
<td><?php echo $thongke['sinhvien']['thanhnien']['nam']?></td>
<td><?php echo $thongke['sinhvien']['thanhnien']['nu']?></td>
</tr>
<tr>
<td>Đoàn viên</td>
<td><?php echo $thongke['canbo']['doanvien']['nam']?></td>
<td><?php echo $thongke['canbo']['doanvien']['nu']?></td>
<td><?php echo $thongke['sinhvien']['doanvien']['nam']?></td>
<td><?php echo $thongke['sinhvien']['doanvien']['nu']?></td>
</tr>
<tr>
<td>Đảng viên</td>
<td><?php echo $thongke['canbo']['dangvien']['nam']?></td>
<td><?php echo $thongke['canbo']['dangvien']['nu']?></td>
<td><?php echo $thongke['sinhvien']['dangvien']['nam']?></td>
<td><?php echo $thongke['sinhvien']['dangvien']['nu']?></td>
</tr>
<tr>
<td style=text-align:center><b>Tổng Nam - Nữ</b></td>
<td><?php echo $tongnamcb?></td>
<td><?php echo $tongnucb?></td>
<td><?php echo $tongnamsv?></td>
<td><?php echo $tongnusv?></td>
</tr>
<tr>
<td style=text-align:center><b>Tổng Cán bộ - Sinh viên</b></td>
<td colspan=2 style=text-align:center><?php echo $tongnamcb + $tongnucb?></td>
<td colspan=2 style=text-align:center><?php echo $tongnamsv+$tongnusv?></td>
</tr>
<tr>
<td style=text-align:center><b>Tổng</b></td>
<td colspan=4 style=text-align:center><?php echo $tongnamcb + $tongnucb + $tongnamsv+$tongnusv?></td>
</tr>
</table>
<?php }?>
<?php $this->Js->get('#khoahocid')->event('change',
							$this->Js->request(array('controller' => 'chidoansvs', 'action' => 'updatechidoan'),
							array('update' => '#chidoan','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));?>
<?php $this->Js->get('#loaidv')->event('change',
							$this->Js->request(array('controller' => 'chidoansvs', 'action' => 'updatechidoan'),
							array('update' => '#chidoan','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));?>